#coding: utf-8

#Import Modules
import pygame
from pygame.locals import *
from pygame.compat import geterror
import gameScenes

import os

def main():

	#Initialize Everything
	screen = pygame.display.set_mode((730, 520),DOUBLEBUF|HWSURFACE)
	pygame.init()
	pygame.display.set_caption('Selecionando uma curva')
	pygame.mouse.set_visible(1)

	#Prepare Game Objects
	clock = pygame.time.Clock()
	
	actual_scene = gameScenes.InitialScene()
	screen = pygame.display.set_mode( actual_scene.get_size() )	
			
	going = True
	while going:
		clock.tick(60)
		
		#Handle Input Events
		for event in pygame.event.get():
			actual_scene.fireEvent(event)
			
			if event.type == QUIT:
				going = False
			elif event.type == KEYDOWN and event.key == K_ESCAPE:
				going = False		
			elif event.type == KEYDOWN and event.key == K_p:
				control.calcular_equipotenciais( vp_termos.get_value() )				
				
		actual_scene.loop_routine()				
		actual_scene.update()

		#Draw Everything
		actual_scene.draw()
		screen.blit(actual_scene.get_surface(),(0,0))
		pygame.display.flip()			
		

	pygame.quit()

	#Game Over	
		
main()


